Skip to content

feat: decode /_stats histogram metrics - #151

Merged
tas50 merged 1 commit into
mainfrom
feat/stats-histograms
Nov 27, 2026
Merged

tas50 merged 1 commit into
mainfrom
feat/stats-histograms

Conversation

@tas50

@tas50 tas50 commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

erchef encodes a histogram metric as sample_sum, sample_count and bucket: [{cumulative_count, upper_bound}], not value (chef_wm_prometheus_json_format:emit_metric). It declares histograms such as the search index batch latencies. StatMetric had only Value, so every histogram decoded as an empty metric.

StatMetric now also carries SampleSum, SampleCount and Buckets []StatBucket. They are strings, like Value, because erchef sends every number as a string. This is additive.

Test plan

  • New test decodes erchef's histogram shape, labels included
  • go test ./... -race, cd integration && go test ./..., golangci-lint

erchef encodes a histogram metric as sample_sum, sample_count and bucket
[{cumulative_count, upper_bound}] instead of value
(chef_wm_prometheus_json_format:emit_metric), and declares histograms
such as the search index batch latencies. StatMetric had only Value, so
each decoded to an empty metric. It now carries SampleSum, SampleCount
and Buckets, as strings like Value, which erchef also sends as strings.

Signed-off-by: Tim Smith <tsmith84@proton.me>
@tas50
tas50 merged commit 91d7119 into main Nov 27, 2026
7 checks passed
@tas50
tas50 deleted the feat/stats-histograms branch November 27, 2026 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant